//
//  UIView+TransitionAnimation.m
//  ModelViewControllerAnimation
//
//  Created by YSC on 15/10/8.
//  Copyright (c) 2015年 YSC. All rights reserved.
//

#import "UIView+TransitionAnimation.h"
#import <QuartzCore/QuartzCore.h>

@implementation UIView(TransitionAnimation)

- (void)addTransitionAnimationWithDuration:(CGFloat)duration type:(NSInteger)type subType:(NSInteger)subType{

    NSArray * types = @[@"pageCurl",@"pageUnCurl",@"rippleEffect",@"suckEffect",@"cube",@"oglFlip"];
    NSArray * subTypes = @[@"fromLeft",@"fromRight",@"fromTop",@"fromBottom"];

    CATransition * transition = [CATransition animation];
    transition.duration = duration;
    transition.type = types[type];
    transition.subtype = subTypes[subType];
    [self.layer addAnimation:transition forKey:nil];
    
}

@end
